<?php

use Phinx\Migration\AbstractMigration;

class CreateUserIdTenantIdUniqueIndexInTenantGrantTable extends AbstractMigration
{
    public function up()
    {
        $this->table("tenant_grant")
            ->addIndex(['user_id', 'tenant_id'], [
                'type' => 'unique',
                'name' => 'idx_tenant_id_and_user_id_unique',
            ])->save();
    }

    public function down()
    {
        $this->table('tenant_grant')
            ->removeIndexByName('idx_tenant_id_and_user_id_unique')
            ->save();
    }
}
